/*
============================================================================
 Name        : SBNinePatchAppUi.cpp
 Author      : LJin
 Version     :
 Copyright   : This is LJin's Program
 Description : Main application UI class (controller)
============================================================================
*/

// INCLUDE FILES
#include <avkon.hrh>
#include <aknmessagequerydialog.h>
#include <aknnotewrappers.h>


#include "SBNinePatch.pan"
#include "SBNinePatchApplication.h"
#include "SBNinePatchAppUi.h"
#include "SBNinePatchAppView.h"
#include "SBNinePatch.hrh"


// ============================ MEMBER FUNCTIONS ===============================


// -----------------------------------------------------------------------------
// CSBNinePatchAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CSBNinePatchAppUi::ConstructL()
	{
	// Initialise app UI with standard value.
	BaseConstructL();

	// Create view object
	iAppView = CSBNinePatchAppView::NewL( ClientRect() );
	
	AddToStackL(iAppView);
	}
// -----------------------------------------------------------------------------
// CSBNinePatchAppUi::CSBNinePatchAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CSBNinePatchAppUi::CSBNinePatchAppUi()
	{
	// No implementation required
	}

// -----------------------------------------------------------------------------
// CSBNinePatchAppUi::~CSBNinePatchAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CSBNinePatchAppUi::~CSBNinePatchAppUi()
	{
	if ( iAppView )
		{
		RemoveFromStack(iAppView);
		delete iAppView;
		iAppView = NULL;
		}
	}

// -----------------------------------------------------------------------------
// CSBNinePatchAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CSBNinePatchAppUi::HandleCommandL( TInt aCommand )
	{
	switch( aCommand )
		{
		case EEikCmdExit:
		case EAknSoftkeyExit:
			Exit();
			break;
		case EBasicCommand1:
			iAppView->iIsNew = !iAppView->iIsNew;
			break;
		default:
			Panic( ESBNinePatchUi );
			break;
		}
	}
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CSBNinePatchAppUi::HandleStatusPaneSizeChange()
	{
	iAppView->SetRect( ClientRect() );
	
	}
		
// End of File
